import {RECEIVE_RATINGS} from './mutation-types'
import axios from 'axios'
export default {
  // 异步获取商家评价列表
  getShopRatings({commit}, callback) {
    axios.get(`http://localhost:8080/ratings`).then((result)=>{
      if (result){
        commit(RECEIVE_RATINGS, result.data)
        // 数据更新了, 通知一下组件
        callback && callback()
      }
    })
  },
  // // 异步获取搜索的商家列表
  // searchShops({commit,state},keyword) {
  //   const geohash =state.latitude +'，' + state.longitude
  //   console.log(geohash)
  //   axios.get(`search_shops`,{keyword,geohash}).then((result)=>{
  //     if (result){
  //       const searchShops = result.data
  //       commit(RECEIVE_SEARCH_SHOPS, {searchShops})
  //     }
  //   }).catch(err=>{
  //     console.log(err)
  //   })
  // },
}
